home *** CD-ROM | disk | FTP | other *** search
/ Interactive Media Design Review 1999 / Interactive Media Design Review 1999.iso / pc / Demos / Herois / Codigo.Cst / 00016_Script_Anima Texto Drag < prev    next >
Text File  |  1999-03-19  |  1KB  |  47 lines

  1. property memberPrim, memberUlt -- Cast members que serao animados
  2. property memPrim, memQuantos -- Membros: em numero
  3. property ultimaTroca -- Hora em que foi feita ultima troca
  4. property fotoAtual
  5. property divide
  6.  
  7. on getBehaviorDescription
  8.   return "Anima sprites"
  9. end
  10.  
  11. on getPropertyDescriptionList
  12.   set p_list = [ ¼
  13.     #divide: [ #comment:   "Pixels de scroll por animacao", ¼
  14.                     #format:   #integer, ¼
  15.                    #default:   16 ], ¼
  16.     #memberPrim: [ #comment:   "Primeiro membro da animacao", ¼
  17.                     #format:   #string, ¼
  18.                    #default:   "" ], ¼
  19.     #memberUlt: [ #comment:   "Ultimo membro da animacao", ¼
  20.                     #format:   #string, ¼
  21.                    #default:   "" ] ¼
  22.   ]
  23.   return p_list
  24. end
  25.  
  26. on beginSprite me
  27.   set memPrim to the number of member memberPrim
  28.   set memQuantos to (the number of member memberUlt) - memPrim + 1
  29.   put 0 into fotoAtual
  30. end
  31.  
  32. on scrollLinha me, quanto
  33.   global gMustUpdate
  34.   
  35.   if quanto <> 0 then  
  36.     -- Descobre qual a proxima figura a trocar
  37.     set tmp = (fotoAtual + quanto) mod (memQuantos*divide)
  38.     if tmp < 0 then set tmp = tmp + memQuantos*divide
  39.     if tmp / divide <> fotoAtual / divide then
  40.       -- Muda figura e updateStage
  41.       set the member of sprite (the spriteNum of me) to memPrim + (tmp/divide)
  42.       set gMustUpdate to true
  43.     end if
  44.     put tmp into fotoAtual
  45.     
  46.   end if
  47. end